package com.xiaohudie.CompressPicture;

import net.coobird.thumbnailator.Thumbnails;

import java.io.File;
import java.io.FileOutputStream;

/**
 * @Author xiao hu die
 * @Date 2022/2/28 14:53
 * @Version 1.0
 */
public class Test03 {
 public static void main(String[] args) throws Exception {
  Thumbnails.of(new File("D:\\1.png"))
         // .size(500, 300) // 图片比例不变
          //按照比例压缩
          .scale(0.65f)
          .toOutputStream(new FileOutputStream("D:\\png\\10003.png"));
 }
}
